package com.example.shop.common;

import lombok.Getter;

/**
 * @author qwer3
 * @version 1.0.0
 * @create 2025/11/3 20:41
 */
@Getter
public enum OrderStatus {
    PENDING("pending", "待付款"),
    PAID("paid", "待发货"),
    SHIPPED("shipped", "待收货"),
    RECEIVED("received", "已完成"),
    CANCELLED("cancelled", "已取消");

    private final String status;
    private final String description;

    OrderStatus(String status, String description) {
        this.status = status;
        this.description = description;
    }

    public static OrderStatus getOrderStatus(String status) {
        for (OrderStatus value : values()) {
            if (value.getStatus().equals(status)) {
                return value;
            }
        }
        throw new IllegalArgumentException("无效的订单状态");
    }
}
